package com.ccys.cms.service.productAndService.impl;

import com.ccys.cms.service.productAndService.MedicalServiceListDetailService;
import com.ccys.common.vo.ResponseResult;
import com.ccys.db.dto.web.productAndService.MedicalServiceListDetailDto;
import com.ccys.db.entity.TblMedicalServiceListDetail;
import com.ccys.db.mapper.TblMedicalServiceListDetailMapper;
import com.ccys.db.page.PageDto;
import com.ccys.db.rely.service.impl.BaseServiceImpl;
import com.ccys.db.vo.web.productAndService.MedicalServiceListDetailPackageVo;
import com.ccys.db.vo.web.productAndService.MedicalServiceListDetailVo;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
@Slf4j
public class MedicalServiceListDetailServiceImpl extends BaseServiceImpl<TblMedicalServiceListDetail> implements MedicalServiceListDetailService {

    @Resource
    private TblMedicalServiceListDetailMapper mapper;

    @Override
    public ResponseResult getServicePage(MedicalServiceListDetailDto dto) {
        PageDto.startPage();
        List<MedicalServiceListDetailVo> list = mapper.getServiceList(dto);
        PageInfo<MedicalServiceListDetailVo> info = new PageInfo<>(list);
        return ResponseResult.success(info);
    }

    @Override
    public ResponseResult getPackagePage(MedicalServiceListDetailDto dto) {
        PageDto.startPage();
        List<MedicalServiceListDetailPackageVo> list = mapper.getPackageList(dto);
        PageInfo<MedicalServiceListDetailPackageVo> info = new PageInfo<>(list);
        return ResponseResult.success(info);
    }

    @Override
    public ResponseResult getServiceListByPackageId(String packageId) {
        List<MedicalServiceListDetailVo> list = mapper.getServiceListByPackageId(packageId);
        return ResponseResult.success(list);
    }

    @Override
    public void deleteDetails(String listId) {
        mapper.deleteDetails(listId);
    }
}
